package main;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.PrinterService;

public class CartridgeTest {
    public static void main(String[] args) {
        // 从类路径下加载Spring配置文件，创建应用上下文
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 从应用上下文中获取打印机服务的实例
        PrinterService printerService = (PrinterService) context.getBean("printerServiceImpl");

        // 调用打印机服务的打印方法，传入要打印的文本和墨盒类型
        printerService.print("这是一段要打印的文本", "black");
        printerService.print("这是另一段要打印的文本", "color");
    }
}
